% ************************************************************************ 
%     Module name   : Lynx Simulation - Radar Init function                                                   
%                                                                          
%     Description   : This will initialise the Radar.                                                    
%                                                                          
%     $Header: /Lynx/SimulationFramework/RSP/IFS/IFSRun.m 2     15/10/08 16:08 Lwabeke $ 
%                                                                          
%    $Author: Lwabeke $	            
%                                                                         
%    $Revision: 2 $                
%                                                                         
% ************************************************************************
%     $History: IFSRun.m $ 
% 
%
% ************************************************************************
function [radarState] = Radar_Init(time, param) %, oldQ)

radarState = [];

radarState.num_radars = param.num_radars;

for cntr=1:radarState.num_radars
    radarState.radar(cntr).radarLocation = param.radars(cntr).location;

    
    %% Determine initial location of radar positioners
   radarState.radar(cntr).posAngle = 0;    % Define to have all pointing to 0 in math coordinate system
                                            % Might want to change this for
                                            % other locations/ 3 radar
                                            % setup
                                          
end

radarState.TargetList.numTargets = 0;
radarState.TargetList.Targets = [];

radarState.targetVisit = 0;

% radarState.searchSetup.chosen_action = 1;
% radarState.searchSetup.sector = param.radarModes.searchMode.numSearchSectors;
% radarState.searchSetup.nextSector = 1;
% 
% radarState.search.time_NCI(1:param.radarModes.searchMode.numSearchSectors) = time -20;
% radarState.search.time_MTI(1:param.radarModes.searchMode.numSearchSectors) = time -20;
% radarState.search.time_Stationary(1:param.radarModes.searchMode.numSearchSectors) = time -20;
% 
% %% Setup Search mode learning
% %radarState.setup_select.Search.Q = rand(param.learn.search.num_states, param.learn.search.num_actions);
% radarState.setup_select.Search.Q = zeros(param.learn.search.num_states, param.learn.search.num_actions)  + 2;  % Initial overestimated reward
% %radarState.setup_select.Search.Q = oldQ;
% % Calculate expected rewards and policy
% [radarState.setup_select.Search.V, radarState.setup_select.Search.policy] = max(radarState.setup_select.Search.Q,[],2);      % Get V and policy as best values for each state
% 
% radarState.setup_select.Search.currentExplore = param.learn.search.explore;
    

